{% extends "xadmin/includes/box.html" %}
{% load i18n xadmin_tags %}
{% load crispy_forms_tags %}

{% block box_attrs %}id="{{ widget_id }}"{% endblock box_attrs %}

{% block box_title %}
  <i class='icon icon-wrench pull-right' data-toggle="modal" data-target="#{{ widget_id }}-opts-form"></i>
  {% block title %}
    {{ widget_title }}
  {% endblock title %}
{% endblock box_title %}

{% block box_content %}
  {% block content %}
  {{ content|safe }}
  {% endblock content %}
{% endblock box_content %}

{% block box_extra %}
  <div class="modal hide fade" tabindex="-1" role="dialog" id="{{ widget_id }}-opts-form">
    <form method="post" class="box-form form-horizontal widget-form">
    {% csrf_token %}
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">×</button>
      <h3>{% trans "Widget Options" %}</h3>
    </div>
    <div class="modal-body">
      {% block form %}
        {% crispy form %}
      {% endblock form %}
      <input type="hidden" name="_delete"/>
    </div>
    <div class="modal-footer">
      <button class="btn btn-danger pull-left btn-remove">{% trans "Remove" %}</button>
      <button class="btn" data-dismiss="modal">{% trans "Close" %}</button>
      <input class="btn btn-primary" type="submit" value="{% trans 'Save changes' %}"/>
    </div>
    </form>
  </div>
{% endblock box_extra %}
